#include <iostream>
#include <pthread.h>
#include <unistd.h>

using namespace std;

void *task(void *p)
{
    while (true)
    {
        cout << "线程" << endl;
        sleep(1);
    }
}

int main()
{

    pthread_t id;
    pthread_create(&id, nullptr, task, nullptr);

    while (true)
    {
        cout << "主线程" << endl;
        sleep(1);
    }

    return 0;
}